home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 17219 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.3 KB

  1. Path: ix.netcom.com!netnews
  2. From: blean@ix.netcom.com (Bob Blean)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: HELP!! How to correctly pass member functions to a C function???
  5. Date: Sun, 14 Apr 1996 00:49:24 GMT
  6. Organization: Netcom
  7. Message-ID: <31704a89.27731156@ixnews8.ix.netcom.com>
  8. References: <4kf534$csn@tilde.csc.ti.com> <4kfslu$s1t@tilde.csc.ti.com>
  9. Reply-To: blean@ix.netcom.com
  10. NNTP-Posting-Host: pax-ca9-13.ix.netcom.com
  11. X-NETCOM-Date: Sat Apr 13  5:49:32 PM PDT 1996
  12. X-Newsreader: Forte Agent .99d/32.182
  13.  
  14. Chuach@dlep1.itg.ti.com (Chua Chye Heng) wrote:
  15.  
  16. >Chuach@dlep1.itg.ti.com (Chua Chye Heng) wrote:
  17. >
  18. >A little more info:
  19. >
  20. >1. when I declared the method to be static, the calling went thro'
  21. >But I am unable to call non-static members in the static method
  22.  
  23. This is similar to another message (about callbacks) recently posted.
  24. In both cases, what is needed:
  25.  
  26. *) Your real callback function needs to be a static function so that
  27. "this" is not an issue for it.
  28.  
  29. *) When you set up the callback, you need to arrange that it will be
  30. passed "this".
  31.  
  32. *) Then your static function uses the "this" pointer it is passed to
  33. call a non-static member function, passing it any other arguments the
  34. callback contained.  At that point, you are in a normal class member
  35. function and handling the callback.
  36.  
  37. --Bob
  38.